|
![]() | ||||||||||
![]() |
CIS 101
Summer, 1999 Instructor: Eli Minkoff |
![]() |
Assignment #4
Write a program in Qbasic.
This Program will check any number
to see if it is divisable by 2.
100 REM "assignment4"
105 CLS
110 LET y = 2
115 PRINT "type in number";
120 INPUT x
125 IF (x / y = INT(x / y)) THEN GOTO 200
'PRINT x / y to test the formula.
'PRINT INT(x / y) ""
130 PRINT "try another number";
135 GOTO 120
200 PRINT "good number"
210 END
Assignment #5
Write a program, this progam checks to
see if a number is a prime nuber or not
This progam below seem to be more english in it and less program,
meaning easier to understand (for me anyway). I wish I
could take credit for the dynamics of this program but I can't I found
it on the web and change it to work for me. I have a lot of studding
to do in this Qbasic before I understand to be able to write like
this. I could not lie if I wanted too. The underline part I did not do
(copied) My work
continues
10 PRINT "Enter an number from 2 and 1000000000" 20 PRINT "We will test to see if it a Prime Number" 30 INPUT NUM 40 IF NUM - INT(NUM) <> 0 THEN GOTO 10 ';GETNUM 50 IF NUM < 2 THEN GOTO 10'; GETNUM 60 IF NUM > 1000000000 THEN GOTO 10'; GETNUM 70 PRIME = 0 80 FOR TRY = 2 TO NUM / 2 IF NUM / TRY <> INT(NUM / TRY) THEN GOTO 120'; TRYMORE PRINT "Factor Found:"; TRY PRIME = 1 120 TRYMORE: 130 NEXT TRY 140 IF PRIME = 1 THEN GOTO 170'; NOTPRIME 150 PRINT "Number is Prime!" 160 GOTO 500'; DONE 170 NOTPRIME: 180 PRINT "Sorry, Number is not prime." 190 PRINT "want to try another number (Y or N)" 200 INPUT X$ 210 IF X$ = "y" THEN 220 GOTO 10 230 ELSE 240 GOTO 500 500 PRINT "hi ho silver away Done" END IF END
Links I am finding this very useful
Lesson tutorial for QBASIC
You will find the original
code here under- prime In the
files list
Usful tutorial for QBASIC
Labs 4.1 to 4.3
Analytical Engine Discussion Group
My Listing no.#1498.
Title
Computer And The Mind
Home